<?php
require 'SiteController.php';
class ProductController extends SiteController{

    public function init()
    {
    	parent::init();
    	
    }
    public function indexAction(){
    	$this->view->headLink()->appendStylesheet($this->view->baseUrl().'/public/skins/default/css/view.css');
    	//lấy sản phẩm từ sllug
    	$slug = $this->getRequest()->getParam('slug');
    	$product = $this->_productModel->getProductBySlug($slug);
    	$this->view->product = $product;
    	//lấy category của sản phẩm
    	$this->view->relateCategory = $product->findParentRow("Model_PCategory");
    	//lấy sản phẩm liên quan
    	$this->view->relateProducts = $this->_productModel->getRelateProducts($product);
    	if(isset($product->page_title) && $product->page_title != ""){
	    		$this->view->headTitle($product->page_title, "SET");
	    	}else{
				$this->view->headTitle("Sieu thi Cuong Phu chuyen: May in HP 1132, May in HP 1102, May in mau HP, May in Canon 2900, May in da nang Canon");
			}
	    	if(isset($product->page_description) && $product->page_description != ""){
	    		$this->view->headMeta()->appendName("description", $product->page_description);
	    	}else{
				$this->view->headMeta("description", "Sieu thi Cuong Phu chuyen cung cap cac loai may in chinh hang voi gia ca re nhat tren thi truong, may in hp 1132, May in HP 1102, may in mau hp, May in Canon 2900, May in da nang Canon");
			}
			if(isset($product["tag"]) && $product["tag"] != "") {
				$this->view->headMeta()->appendName( "keywords",$product->tag);
			}else{
				$this->view->headMeta("keywords", "may in hp 1132, May in HP 1102, may in mau hp, May in Canon 2900, May in da nang Canon, cung cap may in, may in");
			}
    	
    }
    
}
?>